
$title-font-size: 2.44em;
$title-font-size-small: 1.95em;
$overlay-padding: 3em;

$banner-max-height: $overlay-padding*2 + $title-font-size;
//$banner-max-height: 140px;
$banner-max-height-small: $overlay-padding*2 + $title-font-size-small;
$banner-aspect-ratio: 2.48;
$banner-max-width: $banner-max-height * $banner-aspect-ratio/2.44;
$banner-max-width-small: $banner-max-height-small * $banner-aspect-ratio/2.0;

$media-side-margin: 1.5em;

$mm-line-height: 1.5;
$mm-h2-padding-bottom: 0.5em;
$mm-h2-font-size: 1.25em;

$feature-margin-top: 2em;
$feature-margin-bottom: 1em;

@mixin banner--symbol {
  .page__hero--overlay {
    background-position: right bottom;
    background-color: #092d1f;
    background-size: auto $banner-max-height;
    padding: 3.5em 0;

    @include break-max(600px) {
      background-size: auto $banner-max-height-small;
    }
  }

  .page__title, .page__lead {
    max-width: calc(100% - #{$banner-max-width});

    @include break-max(600px) {
        max-width: calc(100% - #{$banner-max-width-small});
    }
  }
}

@mixin banner--map-flex {
  .page__hero--overlay {
    background-position: center;
    //min-height: 15em;
  }

  //mm override
  .wrapper {
    margin-left: 1em;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: max-content;
    background-color: rgba(9, 65, 31, 0.38);

    @include break(small) {
      margin-left: auto;
      display: block;
    }

    p {
      margin-top: 0;
    }
  }
}

@mixin banner--map {
  //mm override
  .wrapper {
    padding: 3em;
    width: max-content;
    margin-left: 0;
    background-image: linear-gradient(to left, rgba(255,255,255,0) 0em, rgba(9, 65, 31,1) 2.5em,
            rgba(9, 65, 31,1) calc(100% - 2.5em), rgba(255,255,255,0));

    @include break-min(80em) {
      margin-left: calc((100% - #{$x-large})/2);
    }

    @include break(medium) {
      width: 100%;
    }
  }
}

.banner-page {
  @include banner--map;
}

.page__hero--overlay {
  padding: 0;
}

.feature-page {

  .feature__wrapper {
    margin-bottom: 3em;

    // Reset mm
    border-bottom: none;
  }

  h2 {
    margin-bottom: $feature-margin-bottom;
  }
}


.feature {
  padding-top: 1em;
  padding-bottom: 1em;

  &:nth-of-type(even) {
    background-color: #f2f3f3;
  }

  &::after {
    content: "";
    display: block;
    clear: both;
  }
}

.feature-content {
  max-width: $max-width;
  margin: auto;
  padding-left: 1em;
  padding-right: 1em;

  h2 {
    margin: $feature-margin-top 0 $feature-margin-bottom;
    border: none;
  }
}

.feature-head {
  @extend .feature-content;
  margin: 2.5em auto;

  &.no-punchline {
    margin-top: 4.5em;
  }
}

.feature-query {
  h3 {
    text-align: center;
    margin-top: 1em;

    @include break(small) {
      text-align: left;
      margin-top: 2em;

    }
  }

  &::after {
    content: "";
    display: block;
    clear: both;
  }
}

.float {
  display: block;
}

.float-left {
  @extend .float;
  float: left;

  @include break(x-small) {
    float: none;
  }
}

.float-right {
  @extend .float;
  float: right;

  @include break(x-small) {
    float: none;
  }
}

.top-align {
  //Works only on floats
  //Align floats to paragraph top.
  margin-top: #{(($mm-line-height - 1)/2)}em;
}

.pos-right {
  margin-left: $media-side-margin;

  @include break(x-small) {
    margin-left: 0;
  }
}

.pos-left {
  margin-right: $media-side-margin;

  @include break(x-small) {
    margin-right: 0;
  }
}

.fp-left {
  @extend .float-left;
  @extend .pos-left
}

.fp-right {
  @extend .float-right;
  @extend .pos-right
}

.pos-twice {
  &.pos-left {
    margin-right: $media-side-margin / 2;

    @include break(x-small) {
      margin-right: 0;
    }
  }
  &.pos-right {
    margin-left: $media-side-margin / 2;

    @include break(x-small) {
      margin-left: 0;
    }
  }
}

.sz-sm {
  max-width: 31.3%;

  @include break(x-small) {
    max-width: 100%;
  }
}

.sz-hf {
  width: calc(50% - #{$media-side-margin / 2});

  @include break(small) {
    width: 100%;
  }
}

.sz-short {
  overflow: auto;
  height: 15em;
}

.sz-short.reset {
  @include break(small) {
    height: auto;
  }
}

.img {
  margin-bottom: 1em;

  @include break(x-small) {
    margin-bottom: 2em;
  }
}

.img-right {
  @extend .img;
  @extend .fp-right;
}

.img-left {
  @extend .img;
  @extend .fp-left;
}

.code {
  margin-bottom: 0;

  @include break(x-small) {
    margin-bottom: 1em;
  }
}

.code-right {
  @extend .code;
  @extend .fp-right;
}

.code-left {
  @extend .code;
  @extend .fp-left;
}

.form-right {
  @extend .fp-right;
  @extend .sz-sm;

  // Reset mm form padding
  padding: 0;
  margin-left: 2.5em;
}

.flex {
  display: flex;
  justify-content: space-between;

  > div {
    margin: 0 1em 0;
  }

  @include break(x-small) {
    flex-direction: column;
  }
}

.fx-form {
  margin-top: ($feature-margin-top
   + $feature-margin-bottom
   + $mm-h2-padding-bottom
   + $mm-h2-font-size);
  width: 15em;

  @include break(x-small) {
    margin-top: 1em;
    min-width: 0;
  }
}

.is-hidden {
  display: none;
}

h2.reset-border {
  border-bottom: none;
}